package com.tqz.rc.client.naming;

import com.tqz.rc.api.Instance;
import com.tqz.rc.common.exception.RcException;

import java.util.List;

/**
 * <p>
 *
 * @author tianqingzhao
 * @since 2021/8/30 10:12
 */
public interface NamingService {

    void registerInstance(String serviceName, String ip, int port) throws RcException;

    void registerInstance(String serviceName, String groupName, String ip, int port) throws RcException;

    void registerInstance(String serviceName, String groupName, String clusterName, String ip, int port) throws RcException;

    void registerInstance(String namespaceId, String serviceName, String clusterName, String groupName, String ip, int port) throws RcException;

    void registerInstance(String serviceName, String groupName, Instance instance) throws RcException;

    List<Instance> selectInstances(String serviceName) throws RcException;

    List<Instance> selectInstances(String serviceName, String groupName) throws RcException;

    List<Instance> selectInstances(String serviceName, List<String> clusters) throws RcException;

    List<Instance> selectInstances(String serviceName, String groupName, List<String> clusters) throws RcException;

    Instance selectOneHealthyInstance(String serviceName) throws RcException;

    Instance selectOneHealthyInstance(String serviceName, String groupName) throws RcException;

    Instance selectOneHealthyInstance(String serviceName,List<String> clusters) throws RcException;

    Instance selectOneHealthyInstance(String serviceName, String groupName, List<String> clusters) throws RcException;

    void shutdown();


}
